package strain.domain;

import java.util.Arrays;

import strain.expression.BaseExpression;
import strain.expression.BoolExpression;

public class BoolDomain extends BaseExpression<Boolean, BoolDomain> implements BoolExpression, DiscreteDomain<Boolean> {

    private final EnumDomain<Boolean> domain;
    
    public BoolDomain(final Boolean value){
        this.domain = new EnumDomain<Boolean>(value);
    }
    
    public BoolDomain(){
        this.domain = new EnumDomain<Boolean>(Arrays.asList(true, false));
    }
    
    public BoolDomain getDomain() {
        return this;
    }

    public int size(){
        return this.domain.size();
    }
    
    public boolean isBound() {
        return this.domain.isBound();
    }

    public Boolean getBoundValue() {
        return this.domain.getBoundValue();
    }

    public boolean bind(final Boolean value) throws InconsistentDomainException {
        return this.domain.bind(value);
    }

    public boolean retain(final BoolDomain values) throws InconsistentDomainException {
        return this.domain.retain(values.domain);
    }

    public boolean remove(final BoolDomain values) throws InconsistentDomainException {
        return this.domain.remove(values.domain);
    }

    public boolean remove(final Boolean value) throws InconsistentDomainException {
        return this.domain.remove(value);
    }

    public boolean propagate() {
        return false;
    }
    
    @Override
    public String toString(){
        return "Bool[" + this.id + "]:" + this.domain.set;
    }

}
